import { getSchoolService } from "../../api/school"; // 假设有一个获取学校列表的API
import { selectorMixin } from "../selector"; // 引入选择器混合器
// 学校选择器
Component({
  behaviors: [selectorMixin],
  data: {
    schools: [],
    searchText: "",
  },
  methods: {
    onSearchInput: async function (e) {
      const searchText = e.detail.value;
      const schoolList = (await getSchoolService({ school: searchText })).data;
      this.setData({
        searchText,
        schools: schoolList,
      });
    },
    onSelectSchool(e) {
      const school = e.currentTarget.dataset.school;
      this.emitSelect(school);
      this.closeSelector();
    },
  },
});
